#pragma once
#include <stdlib.h>
#include <stdio.h>
#include "New.h"
typedef void* Pointer;

typedef struct ddArray {
	const struct TypeDescriptor *type;
	void *begin;
	size_t X;
	size_t Y;
	size_t SIZE;

} DDArray;

static void *ctor_dd ( void *_uk, va_list *a)
{
	DDArray *uk = _uk;
	uk->X = va_arg(*a, size_t);
	uk->Y = va_arg(*a, size_t);
	uk->SIZE = va_arg(*a, size_t);
	uk->begin = (void*)malloc(uk->SIZE * uk->X * uk->Y );
	return uk;
}

static void *dtor_dd( void *_uk) 
{
	DDArray * uk= _uk;
	free(uk->begin);
	return uk;
}

static const struct TypeDescriptor _DDArray = {
	sizeof(DDArray),
	ctor_dd,
	dtor_dd
};

void *find_element (DDArray *a, int y, int x);

void copy (DDArray *in, DDArray *out, int y, int x);

void resize (int hight, int length, DDArray *a);
